<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

class CreateCustomersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('customers', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->char('code', 5)->unique()->comment('客户代码');
            $table->string('name', 50)->comment('公司简称');
            $table->string('phone', 20)->comment('联系电话');
            $table->string('contacts', 20)->comment('联系人');
            $table->tinyInteger('status')->default(0)->comment('状态: 0 草稿 1 审核中 2 审核通过 3 冻结');
            $table->tinyInteger('assure')->default(0)->comment('状态: 0 账册企业 1 电商企业 2 物流企业');
            $table->string('remark', 1000)->nullable()->comment('备注');
            $table->timestamps();
        });
        DB::statement(/** @lang text */ "ALTER TABLE `customers` comment '客户基本信息'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('customers');
    }
}
